Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Vyper support to Sourcify #1784

Merged
merged 11 commits into from
Jan 2, 2025
Merged

Add Vyper support to Sourcify #1784

merged 11 commits into from
Jan 2, 2025

Conversation

marcocastignoli
Copy link
Member

@marcocastignoli marcocastignoli commented Dec 12, 2024

Adds vyper support, here the initial PR: #1760. Below the related tasks:

After merging:

  • publish new docs

@manuelwedler
Copy link
Contributor

I think we should merge this by a merge commit in order to keep the individual commits

@marcocastignoli
Copy link
Member Author

@manuelwedler can you fix the conflicts here?

@manuelwedler
Copy link
Contributor

yes will do so now

marcocastignoli and others added 11 commits January 2, 2025 15:52
…new endpoint `/verify/vyper` in server (#1760)

* add VyperCheckedContract

* rename CheckedContract.solidity to sources

* refactor checkedcontract into an abstract class

* refactor AbstractCheckedContract in server

* use AbstractCheckedContract type in StorageServices

* add /verify/vyper endpoint

* successfully store is database and repository vyper match

* dynamically download the vyper compiler

* fix lib-sourcify-tests

* enable all tests in server

* improve comments for IVyperCompiler

* fix pr suggestions

* rename checkFiles to CheckFilesWithMetadata

* rename useCompiler to useSolidityCompiler

* fix pr suggestions
Finalize vyper api: openapi spec + error handling
* Only log Vyper downloaded on success

* add architecture checks for vyper compiler on mac and improve logging
* Add lib-sourcify tests for Vyper support

* Add server tests for Vyper support
…kedContract (#1783)

* Add support for Vyper cbor auxdata in bytecode-utils and consequently in VyperCheckedContract

* handle vyper incorrect semver versions, support auxdata position also for versions < 0.3.10

* Refactor Solidity and Vyper contract handling to improve auxdata extraction

- Changed `auxdataStyle` in `SolidityCheckedContract` to be a static readonly property.
- Updated bytecode decoding in both `SolidityCheckedContract` and `VyperCheckedContract` to use the static `auxdataStyle`.
- Simplified `generateCborAuxdataPositions` method in `VyperCheckedContract` by introducing a helper function for auxdata position generation.
- Added comments to clarify the use of `AuxdataStyle.SOLIDITY` for bytecode decoding in `ChainMonitor` and session state handlers.
- Ensured that `generateCborAuxdataPositions` is called when necessary in `AbstractDatabaseService` to maintain data integrity.

* add comment to explain `generateCborAuxdataPositions` return conditions

* Refactor bytecode decoding to enhance auxdata handling for Vyper versions. Updated the `decode` function to support various auxdata styles, including specific handling for Vyper versions < 0.3.10 and < 0.3.5. Improved error messages for missing auxdata in bytecode. Updated tests to reflect changes in auxdata style usage.

* Refactor bytecode decoding to replace `compiler` with `vyperVersion` in Vyper-related types and tests.
* Add Vyper documentation in READMEs

* improve lib-sourcify readme

* improve lib-sourcify readme

* improve lib-sourcify documentation

* fix version type in docs
* Add support for immutables

* Remove exclusive test execution for Vyper in verification.spec.ts

* future-proof getImmutableReferences

* - Introduced `auxdataStyle` as an abstract property in `AbstractCheckedContract`
- Updated bytecode decoding methods to utilize instance-specific `auxdataStyle` instead of static references.
- Enhanced `ImmutablesTransformation` to accept dynamic transformation types: replace and insert.
- Adjusted tests to reflect changes in auxdata handling and transformation types.
Don't store full source content in mocked metadata object
* Add database tests for Vyper contract auxdata

* Add database test for Vyper constructor arguments and immutables transformations

* Add verify endpoint test for auxdata transformation with wrong integrity hash

* Add verify endpoint tests for auxdata transformation with wrong vyper version

* Add lib-sourcify test for auxdata transformation
* Updated the Etherscan verification handler to process Vyper contracts alongside Solidity contracts

* Refactor common functions, use correct typing, and fix errors

* Add tests

* handle "*" cases in etherscan vyper json input type

---------

Co-authored-by: Marco Castignoli <[email protected]>
@manuelwedler manuelwedler force-pushed the vyper-verification-main branch from 619dcc7 to 3824d70 Compare January 2, 2025 14:53
@manuelwedler manuelwedler marked this pull request as ready for review January 2, 2025 15:59
@manuelwedler manuelwedler merged commit 5c0c1bd into staging Jan 2, 2025
6 checks passed
@manuelwedler manuelwedler deleted the vyper-verification-main branch January 2, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: COMPLETED
Development

Successfully merging this pull request may close these issues.

2 participants